home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / include / gsl / gsl_rng.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-20  |  17.1 KB  |  561 lines

  1. /* rng/gsl_rng.h
  2.  * 
  3.  * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough
  4.  * 
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or (at
  8.  * your option) any later version.
  9.  * 
  10.  * This program is distributed in the hope that it will be useful, but
  11.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * General Public License for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. #ifndef __GSL_RNG_H__
  21. #define __GSL_RNG_H__
  22. #include <stdlib.h>
  23. #include <gsl/gsl_errno.h>
  24.  
  25. #undef __BEGIN_DECLS
  26. #undef __END_DECLS
  27. #ifdef __cplusplus
  28. # define __BEGIN_DECLS extern "C" {
  29. # define __END_DECLS }
  30. #else
  31. # define __BEGIN_DECLS /* empty */
  32. # define __END_DECLS /* empty */
  33. #endif
  34.  
  35. __BEGIN_DECLS
  36.  
  37. typedef struct
  38.   {
  39.     const char *name;
  40.     unsigned long int max;
  41.     unsigned long int min;
  42.     size_t size;
  43.     void (*set) (void *state, unsigned long int seed);
  44.     unsigned long int (*get) (void *state);
  45.     double (*get_double) (void *state);
  46.   }
  47. gsl_rng_type;
  48.  
  49. typedef struct
  50.   {
  51.     const gsl_rng_type * type;
  52.     void *state;
  53.   }
  54. gsl_rng;
  55.  
  56.  
  57. /* These structs also need to appear in default.c so you can select
  58.    them via the environment variable GSL_RNG_TYPE */
  59.  
  60. #ifdef GSL_EXPORTS
  61. __declspec(dllexport) const gsl_rng_type *gsl_rng_borosh13;
  62. #elif defined(GSL_IMPORTS)
  63. __declspec(dllimport) const gsl_rng_type *gsl_rng_borosh13;
  64. #else
  65. extern const gsl_rng_type *gsl_rng_borosh13;
  66. #endif
  67. #ifdef GSL_EXPORTS
  68. __declspec(dllexport) const gsl_rng_type *gsl_rng_coveyou;
  69. #elif defined(GSL_IMPORTS)
  70. __declspec(dllimport) const gsl_rng_type *gsl_rng_coveyou;
  71. #else
  72. extern const gsl_rng_type *gsl_rng_coveyou;
  73. #endif
  74. #ifdef GSL_EXPORTS
  75. __declspec(dllexport) const gsl_rng_type *gsl_rng_cmrg;
  76. #elif defined(GSL_IMPORTS)
  77. __declspec(dllimport) const gsl_rng_type *gsl_rng_cmrg;
  78. #else
  79. extern const gsl_rng_type *gsl_rng_cmrg;
  80. #endif
  81. #ifdef GSL_EXPORTS
  82. __declspec(dllexport) const gsl_rng_type *gsl_rng_fishman18;
  83. #elif defined(GSL_IMPORTS)
  84. __declspec(dllimport) const gsl_rng_type *gsl_rng_fishman18;
  85. #else
  86. extern const gsl_rng_type *gsl_rng_fishman18;
  87. #endif
  88. #ifdef GSL_EXPORTS
  89. __declspec(dllexport) const gsl_rng_type *gsl_rng_fishman20;
  90. #elif defined(GSL_IMPORTS)
  91. __declspec(dllimport) const gsl_rng_type *gsl_rng_fishman20;
  92. #else
  93. extern const gsl_rng_type *gsl_rng_fishman20;
  94. #endif
  95. #ifdef GSL_EXPORTS
  96. __declspec(dllexport) const gsl_rng_type *gsl_rng_fishman2x;
  97. #elif defined(GSL_IMPORTS)
  98. __declspec(dllimport) const gsl_rng_type *gsl_rng_fishman2x;
  99. #else
  100. extern const gsl_rng_type *gsl_rng_fishman2x;
  101. #endif
  102. #ifdef GSL_EXPORTS
  103. __declspec(dllexport) const gsl_rng_type *gsl_rng_gfsr4;
  104. #elif defined(GSL_IMPORTS)
  105. __declspec(dllimport) const gsl_rng_type *gsl_rng_gfsr4;
  106. #else
  107. extern const gsl_rng_type *gsl_rng_gfsr4;
  108. #endif
  109. #ifdef GSL_EXPORTS
  110. __declspec(dllexport) const gsl_rng_type *gsl_rng_knuthran;
  111. #elif defined(GSL_IMPORTS)
  112. __declspec(dllimport) const gsl_rng_type *gsl_rng_knuthran;
  113. #else
  114. extern const gsl_rng_type *gsl_rng_knuthran;
  115. #endif
  116. #ifdef GSL_EXPORTS
  117. __declspec(dllexport) const gsl_rng_type *gsl_rng_knuthran2;
  118. #elif defined(GSL_IMPORTS)
  119. __declspec(dllimport) const gsl_rng_type *gsl_rng_knuthran2;
  120. #else
  121. extern const gsl_rng_type *gsl_rng_knuthran2;
  122. #endif
  123. #ifdef GSL_EXPORTS
  124. __declspec(dllexport) const gsl_rng_type *gsl_rng_lecuyer21;
  125. #elif defined(GSL_IMPORTS)
  126. __declspec(dllimport) const gsl_rng_type *gsl_rng_lecuyer21;
  127. #else
  128. extern const gsl_rng_type *gsl_rng_lecuyer21;
  129. #endif
  130. #ifdef GSL_EXPORTS
  131. __declspec(dllexport) const gsl_rng_type *gsl_rng_minstd;
  132. #elif defined(GSL_IMPORTS)
  133. __declspec(dllimport) const gsl_rng_type *gsl_rng_minstd;
  134. #else
  135. extern const gsl_rng_type *gsl_rng_minstd;
  136. #endif
  137. #ifdef GSL_EXPORTS
  138. __declspec(dllexport) const gsl_rng_type *gsl_rng_mrg;
  139. #elif defined(GSL_IMPORTS)
  140. __declspec(dllimport) const gsl_rng_type *gsl_rng_mrg;
  141. #else
  142. extern const gsl_rng_type *gsl_rng_mrg;
  143. #endif
  144. #ifdef GSL_EXPORTS
  145. __declspec(dllexport) const gsl_rng_type *gsl_rng_mt19937;
  146. #elif defined(GSL_IMPORTS)
  147. __declspec(dllimport) const gsl_rng_type *gsl_rng_mt19937;
  148. #else
  149. extern const gsl_rng_type *gsl_rng_mt19937;
  150. #endif
  151. #ifdef GSL_EXPORTS
  152. __declspec(dllexport) const gsl_rng_type *gsl_rng_r250;
  153. #elif defined(GSL_IMPORTS)
  154. __declspec(dllimport) const gsl_rng_type *gsl_rng_r250;
  155. #else
  156. extern const gsl_rng_type *gsl_rng_r250;
  157. #endif
  158. #ifdef GSL_EXPORTS
  159. __declspec(dllexport) const gsl_rng_type *gsl_rng_ran0;
  160. #elif defined(GSL_IMPORTS)
  161. __declspec(dllimport) const gsl_rng_type *gsl_rng_ran0;
  162. #else
  163. extern const gsl_rng_type *gsl_rng_ran0;
  164. #endif
  165. #ifdef GSL_EXPORTS
  166. __declspec(dllexport) const gsl_rng_type *gsl_rng_ran1;
  167. #elif defined(GSL_IMPORTS)
  168. __declspec(dllimport) const gsl_rng_type *gsl_rng_ran1;
  169. #else
  170. extern const gsl_rng_type *gsl_rng_ran1;
  171. #endif
  172. #ifdef GSL_EXPORTS
  173. __declspec(dllexport) const gsl_rng_type *gsl_rng_ran2;
  174. #elif defined(GSL_IMPORTS)
  175. __declspec(dllimport) const gsl_rng_type *gsl_rng_ran2;
  176. #else
  177. extern const gsl_rng_type *gsl_rng_ran2;
  178. #endif
  179. #ifdef GSL_EXPORTS
  180. __declspec(dllexport) const gsl_rng_type *gsl_rng_ran3;
  181. #elif defined(GSL_IMPORTS)
  182. __declspec(dllimport) const gsl_rng_type *gsl_rng_ran3;
  183. #else
  184. extern const gsl_rng_type *gsl_rng_ran3;
  185. #endif
  186. #ifdef GSL_EXPORTS
  187. __declspec(dllexport) const gsl_rng_type *gsl_rng_rand;
  188. #elif defined(GSL_IMPORTS)
  189. __declspec(dllimport) const gsl_rng_type *gsl_rng_rand;
  190. #else
  191. extern const gsl_rng_type *gsl_rng_rand;
  192. #endif
  193. #ifdef GSL_EXPORTS
  194. __declspec(dllexport) const gsl_rng_type *gsl_rng_rand48;
  195. #elif defined(GSL_IMPORTS)
  196. __declspec(dllimport) const gsl_rng_type *gsl_rng_rand48;
  197. #else
  198. extern const gsl_rng_type *gsl_rng_rand48;
  199. #endif
  200. #ifdef GSL_EXPORTS
  201. __declspec(dllexport) const gsl_rng_type *gsl_rng_random128_bsd;
  202. #elif defined(GSL_IMPORTS)
  203. __declspec(dllimport) const gsl_rng_type *gsl_rng_random128_bsd;
  204. #else
  205. extern const gsl_rng_type *gsl_rng_random128_bsd;
  206. #endif
  207. #ifdef GSL_EXPORTS
  208. __declspec(dllexport) const gsl_rng_type *gsl_rng_random128_glibc2;
  209. #elif defined(GSL_IMPORTS)
  210. __declspec(dllimport) const gsl_rng_type *gsl_rng_random128_glibc2;
  211. #else
  212. extern const gsl_rng_type *gsl_rng_random128_glibc2;
  213. #endif
  214. #ifdef GSL_EXPORTS
  215. __declspec(dllexport) const gsl_rng_type *gsl_rng_random128_libc5;
  216. #elif defined(GSL_IMPORTS)
  217. __declspec(dllimport) const gsl_rng_type *gsl_rng_random128_libc5;
  218. #else
  219. extern const gsl_rng_type *gsl_rng_random128_libc5;
  220. #endif
  221. #ifdef GSL_EXPORTS
  222. __declspec(dllexport) const gsl_rng_type *gsl_rng_random256_bsd;
  223. #elif defined(GSL_IMPORTS)
  224. __declspec(dllimport) const gsl_rng_type *gsl_rng_random256_bsd;
  225. #else
  226. extern const gsl_rng_type *gsl_rng_random256_bsd;
  227. #endif
  228. #ifdef GSL_EXPORTS
  229. __declspec(dllexport) const gsl_rng_type *gsl_rng_random256_glibc2;
  230. #elif defined(GSL_IMPORTS)
  231. __declspec(dllimport) const gsl_rng_type *gsl_rng_random256_glibc2;
  232. #else
  233. extern const gsl_rng_type *gsl_rng_random256_glibc2;
  234. #endif
  235. #ifdef GSL_EXPORTS
  236. __declspec(dllexport) const gsl_rng_type *gsl_rng_random256_libc5;
  237. #elif defined(GSL_IMPORTS)
  238. __declspec(dllimport) const gsl_rng_type *gsl_rng_random256_libc5;
  239. #else
  240. extern const gsl_rng_type *gsl_rng_random256_libc5;
  241. #endif
  242. #ifdef GSL_EXPORTS
  243. __declspec(dllexport) const gsl_rng_type *gsl_rng_random32_bsd;
  244. #elif defined(GSL_IMPORTS)
  245. __declspec(dllimport) const gsl_rng_type *gsl_rng_random32_bsd;
  246. #else
  247. extern const gsl_rng_type *gsl_rng_random32_bsd;
  248. #endif
  249. #ifdef GSL_EXPORTS
  250. __declspec(dllexport) const gsl_rng_type *gsl_rng_random32_glibc2;
  251. #elif defined(GSL_IMPORTS)
  252. __declspec(dllimport) const gsl_rng_type *gsl_rng_random32_glibc2;
  253. #else
  254. extern const gsl_rng_type *gsl_rng_random32_glibc2;
  255. #endif
  256. #ifdef GSL_EXPORTS
  257. __declspec(dllexport) const gsl_rng_type *gsl_rng_random32_libc5;
  258. #elif defined(GSL_IMPORTS)
  259. __declspec(dllimport) const gsl_rng_type *gsl_rng_random32_libc5;
  260. #else
  261. extern const gsl_rng_type *gsl_rng_random32_libc5;
  262. #endif
  263. #ifdef GSL_EXPORTS
  264. __declspec(dllexport) const gsl_rng_type *gsl_rng_random64_bsd;
  265. #elif defined(GSL_IMPORTS)
  266. __declspec(dllimport) const gsl_rng_type *gsl_rng_random64_bsd;
  267. #else
  268. extern const gsl_rng_type *gsl_rng_random64_bsd;
  269. #endif
  270. #ifdef GSL_EXPORTS
  271. __declspec(dllexport) const gsl_rng_type *gsl_rng_random64_glibc2;
  272. #elif defined(GSL_IMPORTS)
  273. __declspec(dllimport) const gsl_rng_type *gsl_rng_random64_glibc2;
  274. #else
  275. extern const gsl_rng_type *gsl_rng_random64_glibc2;
  276. #endif
  277. #ifdef GSL_EXPORTS
  278. __declspec(dllexport) const gsl_rng_type *gsl_rng_random64_libc5;
  279. #elif defined(GSL_IMPORTS)
  280. __declspec(dllimport) const gsl_rng_type *gsl_rng_random64_libc5;
  281. #else
  282. extern const gsl_rng_type *gsl_rng_random64_libc5;
  283. #endif
  284. #ifdef GSL_EXPORTS
  285. __declspec(dllexport) const gsl_rng_type *gsl_rng_random8_bsd;
  286. #elif defined(GSL_IMPORTS)
  287. __declspec(dllimport) const gsl_rng_type *gsl_rng_random8_bsd;
  288. #else
  289. extern const gsl_rng_type *gsl_rng_random8_bsd;
  290. #endif
  291. #ifdef GSL_EXPORTS
  292. __declspec(dllexport) const gsl_rng_type *gsl_rng_random8_glibc2;
  293. #elif defined(GSL_IMPORTS)
  294. __declspec(dllimport) const gsl_rng_type *gsl_rng_random8_glibc2;
  295. #else
  296. extern const gsl_rng_type *gsl_rng_random8_glibc2;
  297. #endif
  298. #ifdef GSL_EXPORTS
  299. __declspec(dllexport) const gsl_rng_type *gsl_rng_random8_libc5;
  300. #elif defined(GSL_IMPORTS)
  301. __declspec(dllimport) const gsl_rng_type *gsl_rng_random8_libc5;
  302. #else
  303. extern const gsl_rng_type *gsl_rng_random8_libc5;
  304. #endif
  305. #ifdef GSL_EXPORTS
  306. __declspec(dllexport) const gsl_rng_type *gsl_rng_random_bsd;
  307. #elif defined(GSL_IMPORTS)
  308. __declspec(dllimport) const gsl_rng_type *gsl_rng_random_bsd;
  309. #else
  310. extern const gsl_rng_type *gsl_rng_random_bsd;
  311. #endif
  312. #ifdef GSL_EXPORTS
  313. __declspec(dllexport) const gsl_rng_type *gsl_rng_random_glibc2;
  314. #elif defined(GSL_IMPORTS)
  315. __declspec(dllimport) const gsl_rng_type *gsl_rng_random_glibc2;
  316. #else
  317. extern const gsl_rng_type *gsl_rng_random_glibc2;
  318. #endif
  319. #ifdef GSL_EXPORTS
  320. __declspec(dllexport) const gsl_rng_type *gsl_rng_random_libc5;
  321. #elif defined(GSL_IMPORTS)
  322. __declspec(dllimport) const gsl_rng_type *gsl_rng_random_libc5;
  323. #else
  324. extern const gsl_rng_type *gsl_rng_random_libc5;
  325. #endif
  326. #ifdef GSL_EXPORTS
  327. __declspec(dllexport) const gsl_rng_type *gsl_rng_randu;
  328. #elif defined(GSL_IMPORTS)
  329. __declspec(dllimport) const gsl_rng_type *gsl_rng_randu;
  330. #else
  331. extern const gsl_rng_type *gsl_rng_randu;
  332. #endif
  333. #ifdef GSL_EXPORTS
  334. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranf;
  335. #elif defined(GSL_IMPORTS)
  336. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranf;
  337. #else
  338. extern const gsl_rng_type *gsl_rng_ranf;
  339. #endif
  340. #ifdef GSL_EXPORTS
  341. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranlux;
  342. #elif defined(GSL_IMPORTS)
  343. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranlux;
  344. #else
  345. extern const gsl_rng_type *gsl_rng_ranlux;
  346. #endif
  347. #ifdef GSL_EXPORTS
  348. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranlux389;
  349. #elif defined(GSL_IMPORTS)
  350. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranlux389;
  351. #else
  352. extern const gsl_rng_type *gsl_rng_ranlux389;
  353. #endif
  354. #ifdef GSL_EXPORTS
  355. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranlxd1;
  356. #elif defined(GSL_IMPORTS)
  357. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranlxd1;
  358. #else
  359. extern const gsl_rng_type *gsl_rng_ranlxd1;
  360. #endif
  361. #ifdef GSL_EXPORTS
  362. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranlxd2;
  363. #elif defined(GSL_IMPORTS)
  364. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranlxd2;
  365. #else
  366. extern const gsl_rng_type *gsl_rng_ranlxd2;
  367. #endif
  368. #ifdef GSL_EXPORTS
  369. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranlxs0;
  370. #elif defined(GSL_IMPORTS)
  371. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranlxs0;
  372. #else
  373. extern const gsl_rng_type *gsl_rng_ranlxs0;
  374. #endif
  375. #ifdef GSL_EXPORTS
  376. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranlxs1;
  377. #elif defined(GSL_IMPORTS)
  378. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranlxs1;
  379. #else
  380. extern const gsl_rng_type *gsl_rng_ranlxs1;
  381. #endif
  382. #ifdef GSL_EXPORTS
  383. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranlxs2;
  384. #elif defined(GSL_IMPORTS)
  385. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranlxs2;
  386. #else
  387. extern const gsl_rng_type *gsl_rng_ranlxs2;
  388. #endif
  389. #ifdef GSL_EXPORTS
  390. __declspec(dllexport) const gsl_rng_type *gsl_rng_ranmar;
  391. #elif defined(GSL_IMPORTS)
  392. __declspec(dllimport) const gsl_rng_type *gsl_rng_ranmar;
  393. #else
  394. extern const gsl_rng_type *gsl_rng_ranmar;
  395. #endif
  396. #ifdef GSL_EXPORTS
  397. __declspec(dllexport) const gsl_rng_type *gsl_rng_slatec;
  398. #elif defined(GSL_IMPORTS)
  399. __declspec(dllimport) const gsl_rng_type *gsl_rng_slatec;
  400. #else
  401. extern const gsl_rng_type *gsl_rng_slatec;
  402. #endif
  403. #ifdef GSL_EXPORTS
  404. __declspec(dllexport) const gsl_rng_type *gsl_rng_taus;
  405. #elif defined(GSL_IMPORTS)
  406. __declspec(dllimport) const gsl_rng_type *gsl_rng_taus;
  407. #else
  408. extern const gsl_rng_type *gsl_rng_taus;
  409. #endif
  410. #ifdef GSL_EXPORTS
  411. __declspec(dllexport) const gsl_rng_type *gsl_rng_transputer;
  412. #elif defined(GSL_IMPORTS)
  413. __declspec(dllimport) const gsl_rng_type *gsl_rng_transputer;
  414. #else
  415. extern const gsl_rng_type *gsl_rng_transputer;
  416. #endif
  417. #ifdef GSL_EXPORTS
  418. __declspec(dllexport) const gsl_rng_type *gsl_rng_tt800;
  419. #elif defined(GSL_IMPORTS)
  420. __declspec(dllimport) const gsl_rng_type *gsl_rng_tt800;
  421. #else
  422. extern const gsl_rng_type *gsl_rng_tt800;
  423. #endif
  424. #ifdef GSL_EXPORTS
  425. __declspec(dllexport) const gsl_rng_type *gsl_rng_uni;
  426. #elif defined(GSL_IMPORTS)
  427. __declspec(dllimport) const gsl_rng_type *gsl_rng_uni;
  428. #else
  429. extern const gsl_rng_type *gsl_rng_uni;
  430. #endif
  431. #ifdef GSL_EXPORTS
  432. __declspec(dllexport) const gsl_rng_type *gsl_rng_uni32;
  433. #elif defined(GSL_IMPORTS)
  434. __declspec(dllimport) const gsl_rng_type *gsl_rng_uni32;
  435. #else
  436. extern const gsl_rng_type *gsl_rng_uni32;
  437. #endif
  438. #ifdef GSL_EXPORTS
  439. __declspec(dllexport) const gsl_rng_type *gsl_rng_vax;
  440. #elif defined(GSL_IMPORTS)
  441. __declspec(dllimport) const gsl_rng_type *gsl_rng_vax;
  442. #else
  443. extern const gsl_rng_type *gsl_rng_vax;
  444. #endif
  445. #ifdef GSL_EXPORTS
  446. __declspec(dllexport) const gsl_rng_type *gsl_rng_waterman14;
  447. #elif defined(GSL_IMPORTS)
  448. __declspec(dllimport) const gsl_rng_type *gsl_rng_waterman14;
  449. #else
  450. extern const gsl_rng_type *gsl_rng_waterman14;
  451. #endif
  452. #ifdef GSL_EXPORTS
  453. __declspec(dllexport) const gsl_rng_type *gsl_rng_zuf;
  454. #elif defined(GSL_IMPORTS)
  455. __declspec(dllimport) const gsl_rng_type *gsl_rng_zuf;
  456. #else
  457. extern const gsl_rng_type *gsl_rng_zuf;
  458. #endif
  459.  
  460. const gsl_rng_type ** gsl_rng_types_setup(void);
  461.  
  462. #ifdef GSL_EXPORTS
  463. __declspec(dllexport) const gsl_rng_type *gsl_rng_default;
  464. #elif defined(GSL_IMPORTS)
  465. __declspec(dllimport) const gsl_rng_type *gsl_rng_default;
  466. #else
  467. extern const gsl_rng_type *gsl_rng_default;
  468. #endif
  469. #ifdef GSL_EXPORTS
  470. __declspec(dllexport) unsigned long int gsl_rng_default_seed;
  471. #elif defined(GSL_IMPORTS)
  472. __declspec(dllimport) unsigned long int gsl_rng_default_seed;
  473. #else
  474. extern unsigned long int gsl_rng_default_seed;
  475. #endif
  476.  
  477. gsl_rng *gsl_rng_alloc (const gsl_rng_type * T);
  478. int gsl_rng_memcpy (gsl_rng * dest, const gsl_rng * src);
  479. gsl_rng *gsl_rng_clone (const gsl_rng * r);
  480.  
  481. void gsl_rng_free (gsl_rng * r);
  482.  
  483. void gsl_rng_set (const gsl_rng * r, unsigned long int seed);
  484. unsigned long int gsl_rng_max (const gsl_rng * r);
  485. unsigned long int gsl_rng_min (const gsl_rng * r);
  486. const char *gsl_rng_name (const gsl_rng * r);
  487. size_t gsl_rng_size (const gsl_rng * r);
  488. void * gsl_rng_state (const gsl_rng * r);
  489.  
  490. void gsl_rng_print_state (const gsl_rng * r);
  491.  
  492. const gsl_rng_type * gsl_rng_env_setup (void);
  493.  
  494. unsigned long int gsl_rng_get (const gsl_rng * r);
  495. double gsl_rng_uniform (const gsl_rng * r);
  496. double gsl_rng_uniform_pos (const gsl_rng * r);
  497. unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n);
  498.  
  499.  
  500. #ifdef HAVE_INLINE
  501. extern inline unsigned long int gsl_rng_get (const gsl_rng * r);
  502.  
  503. extern inline unsigned long int
  504. gsl_rng_get (const gsl_rng * r)
  505. {
  506.   return (r->type->get) (r->state);
  507. }
  508.  
  509. extern inline double gsl_rng_uniform (const gsl_rng * r);
  510.  
  511. extern inline double
  512. gsl_rng_uniform (const gsl_rng * r)
  513. {
  514.   return (r->type->get_double) (r->state);
  515. }
  516.  
  517. extern inline double gsl_rng_uniform_pos (const gsl_rng * r);
  518.  
  519. extern inline double
  520. gsl_rng_uniform_pos (const gsl_rng * r)
  521. {
  522.   double x ;
  523.   do
  524.     {
  525.       x = (r->type->get_double) (r->state) ;
  526.     }
  527.   while (x == 0) ;
  528.  
  529.   return x ;
  530. }
  531.  
  532. extern inline unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n);
  533.  
  534. extern inline unsigned long int
  535. gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n)
  536. {
  537.   unsigned long int offset = r->type->min;
  538.   unsigned long int range = r->type->max - offset;
  539.   unsigned long int scale = range / n;
  540.   unsigned long int k;
  541.  
  542.   if (n > range) 
  543.     {
  544.       GSL_ERROR_VAL ("n exceeds maximum value of generator",
  545.             GSL_EINVAL, 0) ;
  546.     }
  547.  
  548.   do
  549.     {
  550.       k = (((r->type->get) (r->state)) - offset) / scale;
  551.     }
  552.   while (k >= n);
  553.  
  554.   return k;
  555. }
  556. #endif /* HAVE_INLINE */
  557.  
  558. __END_DECLS
  559.  
  560. #endif /* __GSL_RNG_H__ */
  561.